package com.hdl.servlet.admin;

import java.io.IOException;
import java.util.HashMap;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.hdl.service.MallProductService;
import com.hdl.service.impl.MallProductServiceImpl;
import com.sun.javafx.collections.MappingChange.Map;

@WebServlet("/admin/mallproduct-delelt.let")
public class MallProductDeleltServlet extends HttpServlet{

	private MallProductService mp = new MallProductServiceImpl();
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		 String id = request.getParameter("id");
		 mp.DeleltProductById(id);
		 System.out.println(id);
		 
		 ObjectMapper mapper = new ObjectMapper();
		 HashMap<String, Object> map = new HashMap<String, Object>();
		 map.put("code", 200);
		 
		 mapper.writeValue(response.getOutputStream(), map);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doGet(req, resp);
	}
}
